package com.muzi.facade;

import com.muzi.factory.EquipmentFactory;
import com.muzi.factory.FarmEquipment;
import com.muzi.factory.TractorFactory;
import com.muzi.observer.EnvironmentMonitor;

public class AgricultureSystemFacade {
    //农场设备
    private final EquipmentFactory tractorFactory = new TractorFactory();
    //环境监测
    private final EnvironmentMonitor monitor = new EnvironmentMonitor();

    //启动拖拉机
    public void startTractor() {
        //通过工厂方法创建拖拉机
        FarmEquipment tractor = tractorFactory.createEquipment();
        tractor.operate();
    }

    public void simulateEnvironmentChange(String data) {
        //通过观察者模式监听环境变化
        monitor.detectChange(data); // 模拟环境变化
    }
}